/**
  * Created by lovepocky(lovepocky@foxmail.com) on 2015/11/16.
  */

import org.scalatest._
import collection.mutable.Stack

class ScalatestExtraPractice extends UnitSpec {
	"A Stack" should "pop values in last-in-first-out order" in {
		val stack = new Stack[Int]
		stack.push(1)
		stack.push(2)
		assert(stack.pop() === 2)
		assertResult(1) {stack.pop()}
	}
	
	it should "throw NoSuchElementException if an empty stack is popped" in {
		val emptyStack = new Stack[String]
		intercept[NoSuchElementException] {
			emptyStack.pop()
		}
	}
	
	"My First ScalaTest Practice" should "throw java.lang.Exception" in{
		intercept[Exception]{
			throw new Exception
		}
	}
}

